FROM node:11 AS node
FROM nginx

COPY --from=node /usr/local/bin/node /usr/local/bin/node
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules

RUN cd /usr/local/bin && ln -s ../lib/node_modules/npm/bin/npm-cli.js npm

COPY package.json /src/package.json
RUN cd /src && npm install

COPY . /src
RUN cd /src && npm run build

COPY nginx /etc/nginx